Skip to content

Fix Storybook story ID lookup in macOS stills capture - #14216

Draft
astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/fix-storybook-story-id-lookup-in-macos-stills-capture-00c232
Draft

astracat-bot[bot] wants to merge 2 commits into
mainfrom
codebunny/fix/fix-storybook-story-id-lookup-in-macos-stills-capture-00c232

Conversation

@astracat-bot

@astracat-bot astracat-bot Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

validation: ran pnpm exec vitest run --project node .github/scripts/chrome-macos-stills.test.mjs (19 passed), the workflow’s Storybook build, and the capture and report commands on the original 12 cells using Linux Chrome Headless Shell 158.0.8127.107 in place of branded macOS Chrome 158.0.8127.108 (the unchanged helper captured 8/12 and exited 1; the patched helper captured 12/12 and exited 0).

Maintainer impact

Run #7’s stills job captured 8 of 12 cells on both head and base. Both viewports timed out for each of two story IDs. The dispatch used core-segmented-control--default and core-text-input--default, but Storybook generated core-segmentedcontrol--default and core-textinput--default. The report correctly failed the job for the missing head screenshots.

Intended invariant

Every requested head cell still needs a screenshot. An ID that cannot be resolved uniquely remains a per-cell failure; a missing base cell still does not fail the report.

Change

Resolve the requested ID against each build’s Storybook index before opening a page. Prefer exact matches. Otherwise, accept a unique match that differs only in hyphenation before the story separator, without changing the story variant. Keep the requested cell key for the file and report, and record the resolved ID in JSON when it differs. Ambiguous or unknown IDs fail without waiting for a browser selector.

Evidence

  • CI impact: The affected capture and report commands run in the dispatch-only stills job on macos-15. No pull-request jobs change, so job-minutes per PR update, runner-pool usage for PRs, and time to green are unchanged.
  • Replaying the original capture manifests with the unchanged report reproduced exit 1 twice. A fresh Storybook build and browser reproduced the same 8/12 capture split on the unchanged helper.
  • With the patch, the same browser and build captured all 12 cells under the original keys. The eight already-passing PNGs were byte-identical. The report exited 0 using the new head captures and the original run’s base manifest. The stills test covers exact-match precedence, both reported IDs, ambiguity, and a misspelled story variant.
  • No component or story source changes. The workflow still selects the branded Chrome channel on macOS. The actual macOS dispatch was not rerun.
  • No runner or build changes. On the failed dispatch, the four invalid IDs spent about two minutes waiting per capture side. The patch avoids that wait for unknown IDs and captures these four valid stories instead.

Scope

Stills capture helper and its tests only.

#14208 by cixzhang changes the entry check in chrome-macos-stills.mjs, not chrome-macos-stills.test.mjs.

#14209 by cixzhang also changes this test file.

@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Dec 3, 2026 5:54am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 3, 2026
@astracat-bot

astracat-bot Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Dec 3, 2026, 6:02 AM UTC

@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.

CI impact: 0 job-min per update · pool 0% · standard runners · 2 CI action or script files changed (not measured)
Before After Change
Job-minutes per PR update 202 202 0
Runner pool, runner-minutes a day 24,991 24,991 0 (0%)
Average concurrent jobs 17.4 17.4 0
Time to green (median → this run) — — —
Runs a day 124 124 0

Not measured (the jobs that use these keep their recent minutes above): .github/scripts/chrome-macos-stills.mjs, .github/scripts/chrome-macos-stills.test.mjs.

Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.

Current run: CI concluded failure; parts of this report may be missing.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes: the helper fix looks right, but the description needs two corrections before approval.

  • Add a CI impact: line to the Evidence section, which the CI spec requires for any change to a CI script (for example: no pull-request job changes, since only the dispatch-only stills job on macos-15 runs this helper, so job-minutes per update, runner-pool usage and time to green are unchanged).
  • Correct the overlap note: #14208 changes chrome-macos-stills.mjs (its entry check), not chrome-macos-stills.test.mjs.

The stills tests passed when run locally (19 of 19), and a stubbed-browser run of capture and report matched the described resolution, fail-fast and exit-code behavior. #14209 rewrites the same capture loop, so whichever of the two lands second needs a rebase.

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Title, the stills capture now resolves Storybook story IDs: verified (helper lines 117-135 and 207; local stubbed run).
  • The stills tests pass, 19 of them: verified (run locally, 19 passed).
  • A Linux headless capture went from 8 of 12 to 12 of 12 cells with the patch: reported.
  • The earlier macOS dispatch captured 8 of 12 cells and its report failed the job: reported (its public job record shows the report step failed).
  • Storybook names the two stories core-segmentedcontrol--default and core-textinput--default: verified (story titles Core/SegmentedControl and Core/TextInput).
  • Every requested head cell still needs a screenshot, and a missing base cell does not fail the report: verified (helper lines 322-323; local stubbed run exited 1 and 0).
  • An ID that cannot resolve to one story stays a per-cell failure: verified (per-cell try, ambiguity test, local stubbed run).
  • IDs resolve against each build's index before a page opens, exact match first, otherwise one match that differs only in hyphens before the story separator, never another variant: verified (helper lines 119-129, 189-194 and 207; tests).
  • The requested key still names the file and the report entry, and the JSON records the resolved ID when it differs: verified (helper lines 219-224; local stubbed run).
  • Unknown or ambiguous IDs fail without waiting for a browser selector: verified (local stubbed run opened no page for them).
  • Replays and a fresh build reproduced the failure, and the patched run captured all 12 cells with the eight earlier images byte-identical: reported.
  • The tests cover exact-match precedence, both reported IDs, ambiguity and a misspelled story variant: verified (test lines 224-253, run locally).
  • No component, story, runner or build changes, and branded Chrome is still selected on macOS: verified (two changed files; launch options and workflow unchanged).
  • The macOS dispatch was not rerun, and the failed dispatch waited about two minutes per side: reported.
  • Scope is the stills helper and its tests: verified.
  • #14208 also changes the test file: false (it changes the helper).
  • #14209 also changes the test file: verified.
  • .github/scripts/chrome-macos-stills.mjs: clear.
  • .github/scripts/chrome-macos-stills.test.mjs: clear.

Automated review (maintainer link)

@astracat-bot

astracat-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

This test passes on main now, but no commit on main touched it, so this PR stays open as the fix.

@astracat-bot

astracat-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

validation: ran pnpm exec vitest run --project node .github/scripts/chrome-macos-stills.test.mjs on the updated PR branch (19/19 passed), and on its temporary clean merge with main ba9a8cdd736c1804b17d37e7610c4e4d152c1fe6 (59/59 passed); pnpm review:pre reported a clean merge and no findings; pnpm exec prettier --check .github/scripts/chrome-macos-stills.mjs passed.

Resolved the merge conflict with #14209 by moving the existing resolveStory declaration, unchanged, below storyPath. The conflict was between two helpers inserted at the same position, so no logic change or copy of main's changes is needed. This follow-up changes only .github/scripts/chrome-macos-stills.mjs.

The resulting merge keeps both implementations: resolve the story before opening the page, preserve the requested cell key and resolved-ID receipt, then use main's story-box readiness, scripted steps, and final focus check before the screenshot. All existing assertions are unchanged.

The merged-tree suite's two inherited browser tests ran with Linux Chrome Headless Shell 158.0.8127.107 rather than Playwright's expected 149.0.7827.55, whose download was unavailable. These are supplemental checks; the branch's 19 tests and the conflict-free merge verify the declaration-only update. The branded macOS dispatch and full builds were not rerun.

CI impact: no workflow or pull-request job changes; runner class, job-minutes per update, runner-pool usage, and time to green are unchanged. The existing test, build, and docsite-test failures in run 47015940528 stop at the intentional Heavy CI deferred review gate; this update does not change that policy.

@astracat-bot

astracat-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor Author

This test passes on main now, but no commit on main touched it, so this PR stays open as the fix.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: the fix reads right, and both corrections from the last round are in.

  • The CI impact: line now states what the CI spec asks for: the only job this helper runs in is the dispatch-only stills job on macos-15, a standard GitHub-hosted runner, and no pull-request job changes.
  • The overlap note is now correct: #14208 changes chrome-macos-stills.mjs (its entry check), not the stills test file.
  • Worth a follow-up, not a blocker: the hyphen tolerance is invisible where a dispatcher meets it, since the workflow's cells input and the cell-check error still describe only "a story id like core-button--primary".

The stills tests pass here, 19 of 19, and a stubbed-browser run of capture and report matched the described behavior: resolution before any page opens, the requested key still naming the PNG and the report row, the resolved ID recorded in the JSON, and exit 1 for an uncaptured head cell against exit 0 for a missing base cell. #14209 has since merged into main, and the clean merge of main into this head passes that file's whole suite here, 59 of 59. The heavy suites (test, build and docsite-test) have not run at this head yet, so nothing is ready to merge until the review-pass run is green.

Claims and files checked

Review mode: full; reason: author-not-engowner

  • Title, the stills capture fixes Storybook story ID lookup: verified (helper lines 129-147 and 207; stubbed-browser run here).

  • The stills tests pass, 19 of them: verified (run here, 19 of 19).

  • Storybook builds the two requested stories as the compact IDs: verified (the story titles are Core/SegmentedControl and Core/TextInput).

  • IDs resolve against each build's index before a page opens, exact match first, otherwise the one match that differs only in hyphens before the story separator, never another variant: verified (helper lines 129-147, 189-194 and 207; the three resolveStory tests, run here).

  • The requested key still names the PNG and the report row, and the JSON records the resolved ID when it differs: verified (helper lines 219-224; the run here wrote core-segmented-control--default__1280x800.png and recorded the resolved ID beside it).

  • Unknown or ambiguous IDs fail without waiting for a browser selector: verified (the run here opened three pages for six cells and none for the three unresolvable ones).

  • Every requested head cell still needs a screenshot, and a missing base cell still does not fail the report: verified (helper line 323; the run here exited 1 with a failed head cell and 0 with none and no base).

  • The tests cover exact-match precedence, both reported IDs, ambiguity and a misspelled story variant: verified (test lines 224-253, run here).

  • No component or story source changes, no runner or build change, and branded Chrome is still selected on macOS: verified (two changed files; the launch options and the workflow are untouched).

  • CI impact: no pull-request job changes, so job-minutes per update, runner-pool usage and time to green are unchanged: verified (no workflow file changes; the only pull-request work added is three synchronous unit cases in the existing test job, 0 ms each here).

  • Scope is the stills capture helper and its tests: verified.

  • #14208 changes the entry check in the stills helper, not the stills test file: verified (its file list carries the helper and not the test file).

  • #14209 also changes this test file: verified; it has since merged into main, and the clean merge of main into this head passes that file's whole suite here, 59 of 59.

  • A Linux headless run went from 8 of 12 to 12 of 12 cells with the patch, with the eight earlier images byte-identical and the report exiting 0: reported (your run; not repeated here).

  • The earlier dispatch captured 8 of 12 cells and its report failed the job, and its four invalid cells waited about two minutes per capture side: reported.

  • The macOS dispatch was not rerun: reported.

  • The stills capture helper: clear.

  • Its test file: clear.

Automated review (maintainer link)

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at this exact head.

@cixzhang
cixzhang marked this pull request as draft December 3, 2026 07:28

This branch was successfully deployed

1 active deployment
Preview — 59f3f23c Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant